package schoolWork.work02;

public class bankAccount {
    private String accountNumber;
    private String accountName;
    private String accountAddress;
    private double accountMoney;

    //构造方法
    //public bankAccount(){};
    public bankAccount(String accountNumber,String accountName,String accountAddress, double accountMoney){
        this.accountNumber = accountNumber;
        this.accountName = accountName;
        this.accountAddress = accountAddress;
        this.accountMoney = accountMoney;
    }

    //其他的方法
    //存款
    public void savemoney(double accountMoney){
        this.accountMoney += accountMoney;
    }
    //取款
    public void drawmoney(double accountMoney){
        if(this.accountMoney >= accountMoney) {
            System.out.println("取款成功!");
            this.accountMoney -= accountMoney;
        }
        else
            System.out.println("余额不足");
    }
    //查询
    public void inquiry(){
        System.out.println("您的账号是:" + accountNumber);
        System.out.println("您的储户姓名是:" + accountName);
        System.out.println("您的地址是:" + accountAddress);
        System.out.println("您的余额是:" + accountMoney);
        System.out.println("----------------------------------------");
    }
    //累加利息
    public void addInterest(double accountMoney){
        this.accountMoney += accountMoney;
        System.out.println("利息已累加到您的账户余额");
    }
}
